Combining Static and Dynamic Contract Checking for Curry
نویسنده
چکیده
Static type systems are usually not sufficient to express all requirements on function calls. Hence, contracts with preand postconditions can be used to express more complex constraints on operations. Contracts can be checked at run time to ensure that operations are only invoked with reasonable arguments and return intended results. Although such dynamic contract checking provides more reliable program execution, it requires execution time and could lead to program crashes that might be detected with more advanced methods at compile time. To improve this situation for declarative languages, we present an approach to combine static and dynamic contract checking for the functional logic language Curry. Based on a formal model of contract checking for functional logic programming, we propose an automatic method to verify contracts at compile time. If a contract is successfully verified, dynamic checking of it can be omitted. This method decreases execution time without degrading reliable program execution. In the best case, when all contracts are statically verified, it provides trust in the software since crashes due to contract violations cannot occur during program execution.
منابع مشابه
Static Contract Checking via First-Order Logic
We enrich the static semantics of Haskell in order to give stronger static guarantees about the input/output behavior of programs. Our approach has two parts: a contract system for Haskell, and a novel strategy for statically checking that a term satisfies a contract. The contract system includes refinement types, which refine Haskell types by arbitrary Boolean-valued Haskell expressions, and a...
متن کاملTesting Hypotheses in an Engineering Domain: Combining Static and Dynamic Analysis of Pneumatic Circuits
We want to describe the design of PULSE (Pneumatic Learning and Simulation Environment), an Intelligent Problem Solving Environment (IPSE) for pneumatic circuits based on a cognitive theory of knowledge acquisition (ISP-DLTheory). PULSE offers tasks given as a textual description and a time-discrete kind of a distance-time diagram. It supports unconstrained design of pneumatic circuits. PULSE o...
متن کاملContract-Based Formal Specification of Safety Critical Systems
The paper proposes an approach to light-weight formal specification for interfaces, connectors, contracts and integration of component systems based on UML 2.0 superstructure. Both of static and dynamic contracts are provided with formal models. Dynamic contract can be verified through finding a legal environment in an optimistical way for the integrated components, whose contracts are depicted...
متن کاملCombining Manifest Contracts with State
Manifest contracts combine the rich specifications and runtime checking of higher-order contracts [11] with a static type discipline. Conventional type systems prevent simple errors, like calling a boolean as a function, but manifest contracts can prevent more complex errors. For example, we could give the sqrt function the very precise type {x:Float | x ≥ 0} → {y:Float | |x − y| < }, where sub...
متن کاملSage: Hybrid Checking for Flexible Specifications
Software systems typically contain large APIs that are informally specified and hence easily misused. This paper presents the Sage programming language, which is designed to enforce precise interface specifications in a flexible manner. The Sage type system uses a synthesis of the type Dynamic, first-class types, and arbitrary refinement types. Since type checking for this expressive language i...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- CoRR
دوره abs/1709.04816 شماره
صفحات -
تاریخ انتشار 2017